package com.controller;

import com.model.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

/**
 * Created by caicf on 2016/6/29.
 */
@Controller
@RequestMapping(value = "/sys")
public class LoginCtrl {

    @RequestMapping(value = "/login")
    @ResponseBody
    public ModelAndView login(){
        User user=new User();
        user.setId(2);
        user.setName("caiff");
        user.setDesc1("sdfs");
        ModelAndView mv=new ModelAndView();
        mv.setViewName("home");
        mv.addObject("user",user);
        return mv;
    }

    @RequestMapping(value = "/test")
    @ResponseBody
    public User test1(){
        User user=new User();
        user.setId(2);
        user.setName("的非官方个");
        user.setDesc1("和豆fdsf腐发rrr生的干好地方");
        return user;
    }

    @RequestMapping(value = "/info")
    @ResponseBody
    public User test2() {
        User user=new User();
        user.setId(2);
        user.setName("caicf");
        user.setDesc1("ffffff");
        return user;
    }
}
